Skip to content

fix(transaction-pay-controller): resolve correct networkClientId for source chain in relay execute#8492

Merged
matthewwalsh0 merged 1 commit intomainfrom
fix/relay-execute-network-client-id
Apr 16, 2026
Merged

fix(transaction-pay-controller): resolve correct networkClientId for source chain in relay execute#8492
matthewwalsh0 merged 1 commit intomainfrom
fix/relay-execute-network-client-id

Conversation

@matthewwalsh0
Copy link
Copy Markdown
Member

@matthewwalsh0 matthewwalsh0 commented Apr 16, 2026

Explanation

During cross-chain MetaMask Pay flows, the delegation transaction receives the wrong networkClientId — it gets the target chain's instead of the source chain's. This causes the EIP-7702 authorization nonce to be looked up on the wrong chain, breaking the gasless execute flow.

Resolves the correct networkClientId for the source chain before passing it to getDelegationTransaction, matching the pattern already used in submitViaTransactionController.

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Medium Risk
Touches Relay execute submission logic used in gasless cross-chain Pay flows; a wrong networkClientId could break nonce/authorization handling, but the change is small and covered by targeted tests.

Overview
Fixes the Relay /execute (EIP-7702) submission path to resolve networkClientId from sourceChainId via NetworkController:findNetworkClientIdByChainId before calling TransactionPayController:getDelegationTransaction, instead of implicitly inheriting the original transaction’s network context.

Updates Relay submit tests to assert networkClientId is passed on the delegation transaction and that the source-chain lookup is performed, and records the change in the package changelog.

Reviewed by Cursor Bugbot for commit 71e1067. Bugbot is set up for automated code reviews on this repo. Configure here.

@matthewwalsh0 matthewwalsh0 force-pushed the fix/relay-execute-network-client-id branch from e9897b9 to 523339e Compare April 16, 2026 14:19
…source chain in relay execute

The sourceCallTransaction in submitViaRelayExecute inherited networkClientId
from the original transaction, which references the target chain. This caused
getNonceLock to query the wrong chain, producing an incorrect nonce in the
EIP-7702 authorization list during cross-chain pay flows.

Resolve the correct networkClientId for the source chain via
findNetworkClientIdByChainId before building the source call transaction.
@matthewwalsh0 matthewwalsh0 force-pushed the fix/relay-execute-network-client-id branch from 523339e to 71e1067 Compare April 16, 2026 16:36
@matthewwalsh0 matthewwalsh0 marked this pull request as ready for review April 16, 2026 16:37
@matthewwalsh0 matthewwalsh0 requested review from a team as code owners April 16, 2026 16:37
@matthewwalsh0 matthewwalsh0 enabled auto-merge April 16, 2026 16:45
@matthewwalsh0
Copy link
Copy Markdown
Member Author

@metamaskbot publish-preview

@github-actions
Copy link
Copy Markdown
Contributor

Preview builds have been published. Learn how to use preview builds in other projects.

Expand for full list of packages and versions.
@metamask-previews/account-tree-controller@7.1.0-preview-71e106795
@metamask-previews/accounts-controller@37.2.0-preview-71e106795
@metamask-previews/address-book-controller@7.1.1-preview-71e106795
@metamask-previews/ai-controllers@0.6.3-preview-71e106795
@metamask-previews/analytics-controller@1.0.1-preview-71e106795
@metamask-previews/analytics-data-regulation-controller@0.0.0-preview-71e106795
@metamask-previews/announcement-controller@8.1.0-preview-71e106795
@metamask-previews/app-metadata-controller@2.0.1-preview-71e106795
@metamask-previews/approval-controller@9.0.1-preview-71e106795
@metamask-previews/assets-controller@6.0.0-preview-71e106795
@metamask-previews/assets-controllers@104.0.0-preview-71e106795
@metamask-previews/base-controller@9.1.0-preview-71e106795
@metamask-previews/base-data-service@0.1.1-preview-71e106795
@metamask-previews/bridge-controller@70.1.1-preview-71e106795
@metamask-previews/bridge-status-controller@70.0.5-preview-71e106795
@metamask-previews/build-utils@3.0.4-preview-71e106795
@metamask-previews/chain-agnostic-permission@1.5.0-preview-71e106795
@metamask-previews/claims-controller@0.5.0-preview-71e106795
@metamask-previews/client-controller@1.0.1-preview-71e106795
@metamask-previews/compliance-controller@2.0.0-preview-71e106795
@metamask-previews/composable-controller@12.0.1-preview-71e106795
@metamask-previews/config-registry-controller@0.2.0-preview-71e106795
@metamask-previews/connectivity-controller@0.2.0-preview-71e106795
@metamask-previews/controller-utils@11.20.0-preview-71e106795
@metamask-previews/core-backend@6.2.1-preview-71e106795
@metamask-previews/delegation-controller@3.0.0-preview-71e106795
@metamask-previews/earn-controller@12.0.0-preview-71e106795
@metamask-previews/eip-5792-middleware@3.0.3-preview-71e106795
@metamask-previews/eip-7702-internal-rpc-middleware@0.1.0-preview-71e106795
@metamask-previews/eip1193-permission-middleware@1.0.3-preview-71e106795
@metamask-previews/ens-controller@19.1.1-preview-71e106795
@metamask-previews/eth-block-tracker@15.0.1-preview-71e106795
@metamask-previews/eth-json-rpc-middleware@23.1.1-preview-71e106795
@metamask-previews/eth-json-rpc-provider@6.0.1-preview-71e106795
@metamask-previews/foundryup@1.0.1-preview-71e106795
@metamask-previews/gas-fee-controller@26.1.1-preview-71e106795
@metamask-previews/gator-permissions-controller@4.0.0-preview-71e106795
@metamask-previews/geolocation-controller@0.1.2-preview-71e106795
@metamask-previews/json-rpc-engine@10.2.4-preview-71e106795
@metamask-previews/json-rpc-middleware-stream@8.0.8-preview-71e106795
@metamask-previews/keyring-controller@25.2.0-preview-71e106795
@metamask-previews/logging-controller@8.0.1-preview-71e106795
@metamask-previews/message-manager@14.1.1-preview-71e106795
@metamask-previews/messenger@1.1.1-preview-71e106795
@metamask-previews/messenger-cli@0.1.0-preview-71e106795
@metamask-previews/money-account-balance-service@0.1.0-preview-71e106795
@metamask-previews/money-account-controller@0.1.0-preview-71e106795
@metamask-previews/multichain-account-service@8.0.1-preview-71e106795
@metamask-previews/multichain-api-middleware@2.0.0-preview-71e106795
@metamask-previews/multichain-network-controller@3.0.6-preview-71e106795
@metamask-previews/multichain-transactions-controller@7.0.4-preview-71e106795
@metamask-previews/name-controller@9.1.1-preview-71e106795
@metamask-previews/network-controller@30.0.1-preview-71e106795
@metamask-previews/network-enablement-controller@5.0.2-preview-71e106795
@metamask-previews/notification-services-controller@23.1.0-preview-71e106795
@metamask-previews/permission-controller@12.3.0-preview-71e106795
@metamask-previews/permission-log-controller@5.1.0-preview-71e106795
@metamask-previews/perps-controller@3.1.1-preview-71e106795
@metamask-previews/phishing-controller@17.1.1-preview-71e106795
@metamask-previews/polling-controller@16.0.4-preview-71e106795
@metamask-previews/preferences-controller@23.1.0-preview-71e106795
@metamask-previews/profile-metrics-controller@3.1.3-preview-71e106795
@metamask-previews/profile-sync-controller@28.0.2-preview-71e106795
@metamask-previews/ramps-controller@13.2.0-preview-71e106795
@metamask-previews/rate-limit-controller@7.0.1-preview-71e106795
@metamask-previews/react-data-query@0.2.0-preview-71e106795
@metamask-previews/remote-feature-flag-controller@4.2.0-preview-71e106795
@metamask-previews/sample-controllers@4.0.4-preview-71e106795
@metamask-previews/seedless-onboarding-controller@9.1.0-preview-71e106795
@metamask-previews/selected-network-controller@26.1.0-preview-71e106795
@metamask-previews/shield-controller@5.1.1-preview-71e106795
@metamask-previews/signature-controller@39.2.0-preview-71e106795
@metamask-previews/social-controllers@0.2.0-preview-71e106795
@metamask-previews/storage-service@1.0.1-preview-71e106795
@metamask-previews/subscription-controller@6.1.2-preview-71e106795
@metamask-previews/transaction-controller@64.3.0-preview-71e106795
@metamask-previews/transaction-pay-controller@19.2.0-preview-71e106795
@metamask-previews/user-operation-controller@41.2.0-preview-71e106795

@matthewwalsh0 matthewwalsh0 added this pull request to the merge queue Apr 16, 2026
Merged via the queue into main with commit b1c3586 Apr 16, 2026
345 checks passed
@matthewwalsh0 matthewwalsh0 deleted the fix/relay-execute-network-client-id branch April 16, 2026 17:48
geositta added a commit that referenced this pull request Apr 16, 2026
…sition-live-price-sync

* origin/main:
  fix(transaction-pay-controller): resolve correct networkClientId for source chain in relay execute (#8492)
  Release/920.0.0 (#8494)
  chore: bump `accounts` deps (#8464)
  feat: adds auth to social controllers (#8485)
  Release/919.0.0 (#8482)
  feat(seedless-onboarding-controller): generic encryptor result type aligned with KeyringController TO-686 (#8411)
  Release/918.0.0 (#8478)
  chore: add periodic check for spl tokens (#8400)
github-merge-queue bot pushed a commit to MetaMask/metamask-mobile that referenced this pull request Apr 17, 2026
…2.1 (#28978)

## **Description**

Bumps `@metamask/transaction-pay-controller` from `^19.1.1` to
`^19.2.1`.

### Changes included (since 19.1.1)

**19.2.1**
- Fix: Resolve correct `networkClientId` for source chain in Relay
execute flow ([#8492](MetaMask/core#8492))
- Fix: Stop double-counting subsidized fees in Relay quote target
amounts ([#8488](MetaMask/core#8488))

**19.2.0**
- Bump `@metamask/ramps-controller` from `^13.1.0` to `^13.2.0`
- Bump `@metamask/transaction-controller` from `^64.2.0` to `^64.3.0`

**19.1.3**
- Bump `@metamask/assets-controller` from `^5.0.1` to `^6.0.0`
- Bump `@metamask/bridge-controller` from `^70.1.0` to `^70.1.1`
- Fix: Resolve the effective transaction type from `nestedTransactions`
when the parent is a batch transaction

**19.1.2**
- Bump `@metamask/base-controller` from `^9.0.1` to `^9.1.0`
- Bump `@metamask/assets-controller` from `^5.0.0` to `^5.0.1`
- Bump `@metamask/assets-controllers` from `^103.1.1` to `^104.0.0`
- Bump `@metamask/bridge-controller` from `^70.0.1` to `^70.1.0`

## **Changelog**

CHANGELOG entry: null

## **Related issues**

## **Manual testing steps**

## **Screenshots/Recordings**

## **Pre-merge author checklist**

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I've included tests if applicable
- [x] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I've applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Dependency bumps touch transaction/bridge/payment controller logic,
which can affect critical send/relay flows. There is also a likely
compile/runtime issue from removing `NETWORK_CHAIN_ID.MANTLE` while it’s
still referenced in the image mapping.
> 
> **Overview**
> Updates MetaMask core transaction dependencies, bumping
`@metamask/transaction-pay-controller` to `^19.2.1` and aligning related
controllers in `yarn.lock` (notably `@metamask/transaction-controller`
to `64.3.0`, plus newer `assets`/`bridge`/`ramps` controller versions).
> 
> Removes the `MANTLE` entry from `NETWORK_CHAIN_ID` in
`customNetworks.tsx` while leaving `CustomNetworkImgMapping` referencing
`NETWORK_CHAIN_ID.MANTLE`, which may break builds/type-checking or
runtime mapping for Mantle.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
78d9b57. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
vinnyhoward pushed a commit to MetaMask/metamask-mobile that referenced this pull request Apr 17, 2026
…2.1 (#28978)

## **Description**

Bumps `@metamask/transaction-pay-controller` from `^19.1.1` to
`^19.2.1`.

### Changes included (since 19.1.1)

**19.2.1**
- Fix: Resolve correct `networkClientId` for source chain in Relay
execute flow ([#8492](MetaMask/core#8492))
- Fix: Stop double-counting subsidized fees in Relay quote target
amounts ([#8488](MetaMask/core#8488))

**19.2.0**
- Bump `@metamask/ramps-controller` from `^13.1.0` to `^13.2.0`
- Bump `@metamask/transaction-controller` from `^64.2.0` to `^64.3.0`

**19.1.3**
- Bump `@metamask/assets-controller` from `^5.0.1` to `^6.0.0`
- Bump `@metamask/bridge-controller` from `^70.1.0` to `^70.1.1`
- Fix: Resolve the effective transaction type from `nestedTransactions`
when the parent is a batch transaction

**19.1.2**
- Bump `@metamask/base-controller` from `^9.0.1` to `^9.1.0`
- Bump `@metamask/assets-controller` from `^5.0.0` to `^5.0.1`
- Bump `@metamask/assets-controllers` from `^103.1.1` to `^104.0.0`
- Bump `@metamask/bridge-controller` from `^70.0.1` to `^70.1.0`

## **Changelog**

CHANGELOG entry: null

## **Related issues**

## **Manual testing steps**

## **Screenshots/Recordings**

## **Pre-merge author checklist**

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I've included tests if applicable
- [x] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I've applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Dependency bumps touch transaction/bridge/payment controller logic,
which can affect critical send/relay flows. There is also a likely
compile/runtime issue from removing `NETWORK_CHAIN_ID.MANTLE` while it’s
still referenced in the image mapping.
> 
> **Overview**
> Updates MetaMask core transaction dependencies, bumping
`@metamask/transaction-pay-controller` to `^19.2.1` and aligning related
controllers in `yarn.lock` (notably `@metamask/transaction-controller`
to `64.3.0`, plus newer `assets`/`bridge`/`ramps` controller versions).
> 
> Removes the `MANTLE` entry from `NETWORK_CHAIN_ID` in
`customNetworks.tsx` while leaving `CustomNetworkImgMapping` referencing
`NETWORK_CHAIN_ID.MANTLE`, which may break builds/type-checking or
runtime mapping for Mantle.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
78d9b57. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants